import request from '@/utils/request'

/**
 * 获取负责人列表
 * @returns {promise}
 */
export function getManagerList() {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 获取员工列表
 * @param {*} params.page 第几页
 * @param {*} params.size 每页显示多少条
 * @returns {promise}
 */
export const getEmployeeList = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}
// 新增员工
export const addEmployee = (data) => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 删除员工
export const delEmployee = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}
// 批量导入
export const batchEmployee = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
// 保存员工基本信息
export const saveUserDetailById = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}
// 给员工分配角色
export const assignRoles = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
